import { ui } from "../../ui/layaMaxUI";
import Game from "../../core_wq/game/Game";
import GameEvent from "../../core_wq/game/GameEvent";
import { GameStateType } from "../../core_wq/game/GameStateType";
import { GameStageType } from "../../core_wq/game/GameStageType";



export default class TopLevelView extends ui.moduleView.main.TopLevelViewUI {


    constructor(){
        super();
        Laya.stage.on(GameEvent.LEVEL_UPDATE,this,this.updateLevel);
    }


    onEnable() {
        if (this.levelText&&Game.gameStage.stageData) {
           this.updateLevel(Game.gameStage.stageData.curLevel);
        }
    }

    updateLevel(level:number){
        if(this.levelText){
            if(Game.gameStage.stageVO.stageType===GameStageType.BOSS){
                this.levelText.text="---BOSS---";
            }
            else{
                this.levelText.text="关卡 "+level;
            }
        }
         
    }




}